<!DOCTYPE html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>投资网 | 登录</title>
  <meta name="keywords" content="投资,投资商城,在线投资网" />
  <meta name="description" content="在线投资网用全新区块链技术，倾心打造。" />
  <link href="./../../layui/css/layui.css" rel="stylesheet" />
  <link href="./../../css/mall.css" rel="stylesheet" />
  <style media="screen">
    body,
    html {
      height: 100%;
    }

    body {
      width: 100%;
      background: url('./../../images/bgimg.png') no-repeat;
      background-size: 100% auto;
    }
  </style>
</head>

<body class="">
  <div class="layui-layout layui-layout-admin">
    <div class="layui-header header_color">
      <div class="content header">
        <a href="javascript:" title="一个不一样的投资网">
          <div class="logo">
            <img src="/images/face.jpg" class="logoimg" />
            <span>在线投资网</span>
          </div>
        </a>
        <ul class="layui-nav layui-layout-left daohang">
          <li class="layui-nav-item"><a href="/index.html">首页</a></li>
          <li class="layui-nav-item"><a href="/page/list/list.html">所有产品<span class="layui-badge-dot"></span></a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
          <li class="layui-nav-item">
            <a href="/page/reg/sign.html">
                  <i class="layui-icon">&#xe68e;</i>    登录
                </a>
          </li>
          <li class="layui-nav-item userBox layui-hide">
            <a href="javascript:;">
                <img src="/images/face.jpg" class="layui-nav-img">喜欢狗的猫
            </a>
            <dl class="layui-nav-child">
                <dd><a href="/user/set">基本信息</a></dd>
                <dd><a class="login_out">安全退出</a></dd>
            </dl>
          </li>
        </ul>
      </div>
    </div>
  </div>
  <div class="layui-container fly-marginTop loginbox">
  <div class="fly-panel fly-panel-user" pad20>
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title">
        <li class="layui-this">登录</li>
        <li><a href="./reg.html">注册</a></li>
      </ul>
      <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
        <div class="layui-tab-item layui-show">
          <div class="layui-form layui-form-pane">
            <form method="post" action="/admin/login">
              <div class="layui-form-item">
                <label class="layui-form-label">手机</label>
                <div class="layui-input-inline">
                  <input type="text" name="tel" required lay-verify="required|phone" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="password" required lay-verify="required" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <button class="layui-btn" lay-filter="login" lay-submit>立即登录</button>
                <span style="padding-left:20px;">
                  <a>忘记密码？</a>
                </span>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
  </div>
  <script src="/layui/layui.all.js"></script>
  <script src="/js/common.js"></script>
  <script src="./../../js/default.js"></script>
  <script>
    layui.use(['layer', 'form', 'element'], function() {
      var $ = layui.jquery,
        layer = layui.layer,
        form = layui.form,
        element = layui.element;

      form.on('submit(login)', function(data) {
        console.log(data.field);
        $.ajax({
          url: '/admin/login',
          data: data.field,
          processData: true,
          cache: false,
          type: 'post',
          async: false,
          contentType: "application/x-www-form-urlencoded", // 不设置内容类型
          success: function(json) {
            var data = json.data;
            if (json.status == "1") {
              layer.msg('登录成功');
              commonService.localStorage('userInfo', data);
              window.location.href = "/admin/index";
            } else {
              layer.msg('用户名或密码错误！');
            }
          }
        });
        return false;
      });
    })
  </script>
</body>
